-
Notifications
You must be signed in to change notification settings - Fork 813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace grpcio with tonic #2112
Replace grpcio with tonic #2112
Conversation
Build Failed 😱 Build Id: e23f165b-9168-455e-bcfd-5ef07ce18926 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
async-stream = "0.3" | ||
http = "0.2" | ||
prost = "0.7" | ||
thiserror = "1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This replaces error-chain, which has seen declining usage in the rust ecosystem due to its fairly confusing and heavy approach to errors. That being said, the current error usage is extremely minimal, and we could get rid of thiserror as well and just use a custom error, since it's only used to wrap grpc status messages anyways since the sdk protocol doesn't have its own error types at all.
[dependencies.tokio] | ||
version = "1.0" | ||
default-features = false | ||
features = ["sync", "time"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tonic is built on top of tokio which is (basically) the standard async runtime in the rust ecosystem.
[dependencies.tonic] | ||
version = "0.4" | ||
default-features = false | ||
features = [ | ||
"codegen", | ||
"transport", | ||
"prost", | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tonic is a rust native GRPC stack built on top of tokio.
[build-dependencies.tonic-build] | ||
version = "0.4" | ||
default-features = false | ||
features = [ | ||
"prost", | ||
"transport", | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The common practice for tonic is to build the protocol buffers at build time, rather than checking the generated code into source, unlike the previous implementation. I can change this if needed.
sdks/rust/src/sdk.rs
Outdated
pub fn ready(&self) -> Result<()> { | ||
let req = sdk::Empty::default_instance(); | ||
let res = self.client.ready(req).map(|_| ())?; | ||
Ok(res) | ||
#[inline] | ||
pub async fn ready(&mut self) -> Result<()> { | ||
Ok(self.client.ready(empty()).await.map(|_| ())?) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just as with the Alpha client, tonic is async only, so just removed all of the sync methods.
Build Failed 😱 Build Id: 4deaee5a-ab75-4a45-a3f6-267b1a6fa3d8 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: 5db92ab6-cdf7-441a-8d17-0832201b6943 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
6a5d729
to
61a8699
Compare
Build Failed 😱 Build Id: 17301a23-5de1-4a9e-8a35-fae22c11f071 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: fb6e3535-f9a8-4d41-9c71-53a7a3b15637 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Failed 😱 Build Id: 9ae4e7dc-9c64-4a1d-957c-67921f6ab46d To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
/assign @markmandel |
It looks like the sdk conformance tests for rust are failing:
|
Build Succeeded 👏 Build Id: 0531b236-0c14-4d51-a7d7-9f8b1c73f7a9 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work! This overall looks like an improvement!
My only concern is that this breaks backward compatibility with the previous SDK -- how concerned are we about this? I'm not sure how many users of the Rust SDK we actually have, so it may be a non issue.
I considered API breakage not super important since the crate has never been published so no API compatibility promises had been made, though I tried not to go too crazy. |
Yeah, I figure it's probably fine. Also you can always STILL use the previously published code, it doesn't stop working. @roberthbailey do you have any thoughts on the backward compatibility side of things? I think it's fine, but just want to cover all bases. |
The only compatibility issues is between the game server and the sdk, which would be caught at compile time. The SDK <-> sidecar should remain the same, so this should be compatible across older and newer Agones releases. Since you don't need to adopt a new SDK for a new agones release (unless it has new features that you need) I don't see any issues requiring folks to make some changes to their code to adopt a new sdk version. This is actually pretty similar to the process we go through when upgrading client-go .... older versions should work just fine with the k8s apiserver, but when we want the newer code, we pull it in and sometimes need to make changes to our code so that it still compiles and works with the updated libraries. |
Well said! I concur! So there are some comments above for review - but to add an extra item, we should also update https://agones.dev/site/docs/guides/client-sdks/rust/ to include new documentation for the new SDK. https://agones.dev/site/docs/contribute/#at-the-page-level |
The logs from CD runs are incredibly hard to read since they are just intermixed with all tests, so I prefixed all of the print messages from the rust example so I can actually read the output more easily.
documentation
Removed the auto health check task since that actually made health checking meaningless since it's _supposed_ to be sent by the application itself when it working properly, not automatically
This method should be better than the previous test/examples as the health check will actually be canceled if the task/thread the health check is owned by is canceled for any reason
cbdfa68
to
ed847f3
Compare
Build Succeeded 👏 Build Id: 48c95b18-c87c-4f58-a44d-5393e299fda1 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
Sorry, I'm in CET so I rebased just before heading to bed, hopefully you can look at it relatively early your time to get it in, I will only be semi-available tomorrow since it's Midsommar. |
/kind feature
What this PR does / Why we need it:
This PR replaces the Rust SDK's use of grpcio with tonic.
Which issue(s) this PR fixes:
Closes #1300
Special notes for your reviewer:
I'll leave inline review comments on the changes themselves, and comment in #1300 on why tonic is preferred.